﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Inspector.Modules
{
    public partial class Network : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void dropSelector_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var list = new List<string>();
                list.AddRange(new string[]{
            "Win32_NetworkAdapter",
            "Win32_NetworkAdapterConfiguration",
            "Win32_NetworkAdapterSetting",
            "Win32_NetworkClient",
            "Win32_NetworkConnection",
            "Win32_NetworkLoginProfile",
            "Win32_NetworkProtocol",
            "Win32_PerfRawData_Tcpip_ICMP",
            "Win32_PerfRawData_Tcpip_IP",
            "Win32_PerfRawData_Tcpip_NBTConnection",
            "Win32_PerfRawData_Tcpip_NetworkInterface",
            "Win32_PerfRawData_Tcpip_TCP",
            "Win32_PerfRawData_Tcpip_UDP",
            "Win32_PerfRawData_W3SVC_WebService",
            "Win32_SystemNetworkConnections"});
                foreach (var item in list)
                {
                    dropSelector.Items.Add(new ListItem(item, item));
                }
            }
        }

        protected void dropSelector_SelectedIndexChanged(object sender, EventArgs e)
        {
            mainGrid.DataSource = InspectorUtils.GetMachineProperties(dropSelector.SelectedValue);
            mainGrid.DataBind();
        }
    }
}